import { Body, Controller, Delete, Get, Param, Post, Put } from "@nestjs/common";
import { ApiOperation, ApiTags } from "@nestjs/swagger";
import { AccessDto } from "../dto/access.dto";
import { Access } from "../entities/access.entity";
import { AccessService } from "../service/access.service";
@ApiTags('access - 权限')
@Controller("access")
export class AccessController {
    constructor(
        private readonly accessService: AccessService
    ) { }

    @Post()
    @ApiOperation({
        summary: "创建新的功能权限",
    })
    async create(@Body() access: AccessDto) {
        return await this.accessService.create(access);

    }

    @Get()
    @ApiOperation({
        summary: "查询所有的功能权限",
    })
    async findAll() {
        return await this.accessService.findAll();
    }

    @Put()
    @ApiOperation({
        summary: "修改的功能权限",
    })
    async update(@Body() access: Access) {
        return await this.accessService.update(access);
    }

    @Delete("/:id")
    @ApiOperation({
        summary: "删除的功能权限",
    })
    async delete(@Param("id") id: number) {
        return await this.accessService.delete(id);
    }


}